﻿// Write a program that calculates N!/K! for given N and K (1<K<N).

using System;

class NFactorialDividedByKFactorial
{
    static void Main()
    {

        Console.Write("Enter positive number K : ");
        string numberKStr = Console.ReadLine();
        long numberK;
        while (!long.TryParse(numberKStr, out numberK))
        {
            Console.Write("Invalid input! Enter K again : ");
            numberKStr = Console.ReadLine();
        }

        Console.Write("Enter number N bigger than K : ");
        string numberNStr = Console.ReadLine();
        long numberN;
        while (!long.TryParse(numberNStr, out numberN))
        {
            Console.Write("Invalid input! Enter N again : ");
            numberNStr = Console.ReadLine();
        }

        if (numberK <= 1 || numberK >= numberN || numberN <=2)
        {
            Console.WriteLine("Invalid input. The values should be 1 < K < N.");
        }
        else
        {
            long product = 1;

            for (long i = numberK + 1; i <= numberN; i++)
            {
                product *= i;
            }

            Console.WriteLine("The result of N!/K! is : {0}", product);
        }
    }
}
